﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using SQLiteClient;
using System.Collections.Generic;
using CSKLiteWindowsPhone.WebsiteData;
using System.IO.IsolatedStorage;

namespace CSKLiteWindowsPhone.Common
{
    public class Utility
    {
        public static SQLiteConnection GetConnection()
        {
            SQLiteConnection conn = new SQLiteConnection(Constants.DBFileName);
            conn.Open();

            return conn;
        }

        public static WebsiteDataSoapClient GetWebsiteDataSoapClient()
        {
            string address = "http://www.qa.badgroup.com/services/websitedata.asmx";
            if (IsolatedStorageSettings.ApplicationSettings.Contains(Constants.EnviromentKey))
            {
                address = (IsolatedStorageSettings.ApplicationSettings[Constants.EnviromentKey] as Enviroment).Value;
            }
            WebsiteDataSoapClient client = new WebsiteDataSoapClient();
            client.Endpoint.Address = new System.ServiceModel.EndpointAddress(address);

            return client;
        }
    }
}
